package wyu.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import wyu.service.UserPostCollectService;

import javax.annotation.Resource;
import java.util.List;

/**
 * 用户-帖子-收藏关联控制类
 * */
@RestController
@RequestMapping("/user_post_collect")
public class UserPostCollectController {
    @Resource
    UserPostCollectService userPostCollectService;
    @GetMapping("/getCollectList")
    public List<String> getCollectList(@RequestParam("postId")int postId){
        return userPostCollectService.getCollectList(postId);
    }

    @GetMapping("/getCollectCount")
    public int getCollectCount (@RequestParam("postId")int postId){
        return userPostCollectService.query().eq("POST_ID",postId).count();
    }
}
